<template>
	<view class="card">
		<view class="card__top">
			<view class="card__top__content">
				<slot name="top__name">
					<view class="card__name">{{title}}</view>
				</slot>
			</view>
			<view class="card__top__utils">
				<slot name="top__utils">
					<view class="card__utils" @click="utilsEvent">
						<view class="">{{utilsName}}</view>
						<Icon :href="utilsIcon" size="30rpx"/>
					</view>
				</slot>
			</view>
		</view>
		<slot name="card__content">
			<view>内容</view>
		</slot>
	</view>
</template>

<script setup>
	import Icon from '@/common/components/Icon/index.vue';
	const props = defineProps({
		title:{
			type:String,
			required:true
		},
		utilsName:{
			type:String,
			default:"更多"
		},
		utilsIcon:{
			type:String,
			default:"jiantouzuo"
		}
	})
	const emits = defineEmits(["utilsEvent"])
	function utilsEvent(e){
		emits("utilsEvent",e)
	}
</script>

<style lang="scss">
	.card{
		display: flex;
		flex-direction: column;
		gap: 10px;
		padding: 20rpx 20rpx;
		border-radius: 6rpx;
		background-color: white;
		font-size: 30rpx;
		.card__top{
			display: flex;
			align-items: center;
			&__content{
				flex: 1;
				overflow: hidden;
				font-weight: bold;
				padding: 20rpx 0;
			}
				
			&__utils{
				width: 100rpx;
			}
		}
	
		.card__utils{
			display: flex;
			align-items: center;
			font-weight: bold;
		}
		.card__name{
			font-size: 40rpx;
		}
	}
</style>